package com.allen.flink.batch;

import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.configuration.Configuration;

/**
 * 功能:递归读取目录下文件
 *
 * @date: 2020-03-24 12:44
 * @author: Allen
 * @version: 0.0.4-snapshot
 * @Email: allenZyhang@163.com
 * @since: JDK 1.8
 **/
public class RecursionRead {
    
    public static void main(String[] args) throws Exception {
        //获取执行环境
        final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    
        //创建配置
        Configuration config=new Configuration();
        
        //设置递归参数
        config.setBoolean("recursive.file.enumeration",true);
        
       DataSet<String> ds= env.readTextFile("file://D:\\Flink").withParameters(config);
       
       ds.print();
    }
}
